package com.android.widget;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

public class MainActivity extends AppCompatActivity {

    private int index = 0;
    private ThinkMapView thinkMap;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        thinkMap = findViewById(R.id.thinkMap);
        thinkMap.setOnNodeClickListener(new ThinkMapView.OnNodeClickListener() {
            @Override
            public void onNodeClick(ThinkNode node) {
                if (!node.isOrigin()) {
                    Log.e("RRL", "=======onNodeClick=====>" + node.getText() + "," + node.getId() + ",getFirstLevelNode:" + node.getFirstLevelNode().getText());
                }
                index++;
                thinkMap.addChildNode(node, "子节点-" + index);
            }
        });
    }
}
